package com.rxjava.jdbc;

import static org.junit.Assert.assertEquals;

import java.util.List;

import rx.Observable;

import com.github.davidmoten.rx.jdbc.Database;

public class RxJdbc {
	public static Database db;
	public static final String url = "jdbc:mysql://192.168.0.114:3306/mysql?useUnicode=true&characterEncoding=utf8&autoReconnect=true&amp;failOverReadOnly=false";
	public static final String username = "root";
	public static final String password = "login";
	
	static{
		db = Database.from(url, username, password);
	}
	
	public Observable<List<String>> queryUser(){
		Observable<List<String>> names = db
		        .select("select Host from user order by Host")
		        .getAs(String.class)
		        .toList();
		return names;
	}
}
